<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>IPX-Agent</title>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="//at.alicdn.com/t/font_si1k8rrgrchxgvi.css">
</head>
<body>
<div id="app"></div>
<script type="text/javascript">
    var getLanguage = function(){
        if (cookie('language')) {
            return cookie('language');
        }

        switch ((window.navigator.language || window.navigator.browserLanguage).toLowerCase().split(/[_-]+/)[0]) {
            case 'en':
                return 'en_US';
            case 'zh':
                return 'zh_CN';
            default:
                return 'en_US';
        }
    };

    var cookie = function (name, value, options) {
        if (typeof value !== 'undefined') {
            options = options || {};
            if (value === null) {
                value = '';
                options.expires = -1;
            }
            var expires = '';
            if (options.expires && (typeof options.expires === 'number' || options.expires.toUTCString)) {
                var date;
                if (typeof options.expires === 'number') {
                    date = new Date();
                    date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
                } else {
                    date = options.expires;
                }
                expires = '; expires=' + date.toUTCString();
            }
            var path = options.path ? '; path=' + (options.path) : '';
            var domain = options.domain ? '; domain=' + (options.domain) : '';
            var secure = options.secure ? '; secure' : '';
            document.cookie = [
                name,
                '=',
                encodeURIComponent(value),
                expires,
                path,
                domain,
                secure
            ].join('');
        } else {
            var cookieValue = null;
            if (document.cookie && document.cookie !== '') {
                var cookies = document.cookie.split(';');
                for (var i = 0, len = cookies.length; i < len; i++) {
                    var cookie = cookies[i].trim();
                    if (cookie.substring(0, name.length + 1) === (name + '=')) {
                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                        break;
                    }
                }
            }
            return cookieValue;
        }
    };

    var language = getLanguage();
    var googleLanguage = 'zh-cn';
    if (language === 'zh_CN') {
        document.title = 'IPX-经纪人-Agent';
        googleLanguage = 'zh-cn';
    } else {
        document.title = 'IPX-Agent';
        googleLanguage = 'en-us';
    }
    var googleScript = document.createElement('script');
    googleScript.type = "text/javascript";
    googleScript.src = window.location.protocol + '//ditu.google.cn/maps/api/js?key=AIzaSyCypGckZ5e0FtzEVU-9BpxzY_P_lYb_Bzc&sensor=false&libraries=places&language=' + googleLanguage;
    document.body.appendChild(googleScript);
</script>
</body>
</html>
